package com.stormrage.edu.schedule;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.stormrage.edu.serv.learn.LeaBunchApplyServ;
import com.stormrage.edu.serv.learn.LeaBunchServ;
import com.stormrage.entity.learn.LeaBunchApply;
import com.stormragetech.core.util.DateUtil;

public class AdoptBunchApplySchedule {

	private static final Logger logger = LoggerFactory.getLogger(AdoptBunchApplySchedule.class);

	@Autowired
	private LeaBunchServ leaBunchServ;

	@Autowired
	private LeaBunchApplyServ leaBunchApplyServ;

	public void adoptApply() {

		try {

			logger.debug(" ------ 执行计划 ------ [ AdoptBunchApplySchedule ] ------ 时间 ------"
					+ DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss"));

			List<LeaBunchApply> array = leaBunchApplyServ.queryByLock(2);

			logger.debug(" 原先数量 >>>>>>> " + array.size());

			leaBunchServ.updateLock();

			array = leaBunchApplyServ.queryByLock(2);

			logger.debug(" 现在数量 >>>>>>> " + array.size());

			logger.debug(" ------ 执行计划 ------ [ AdoptBunchApplySchedule ] ------ 结果 : [ 成功 ] ");

		} catch (Exception e) {
			logger.debug(" ------ 执行计划 ------ [ AdoptBunchApplySchedule ] ------ 结果 : [ 失败 ] ");
		}

	}

}
